odoo.define('swr.web.datepicker', function (require) {
"use strict";

var core = require('web.core');
var DatePicker = require('web.datepicker');
//var formats = require('web.formats');
var time = require('web.time');

var _t = core._t;

DatePicker.DateWidget.include({
        init: function (parent, options) {
            this._super.apply(this, arguments);
            var _options = {};
            if (parent.attrs&&parent.attrs.options && (parent.attrs.options.showType==="months" || parent.attrs.options.showType==="years")) {
                var l10n = _t.database.parameters;
                console.log()
                _options.showType = parent.attrs.options.showType;
                _options.viewMode = parent.attrs.options.showType;
                _options.minViewMode = parent.attrs.options.showType;
                _options.format = time.strftime_to_moment_format((parent.attrs.options.showType==="months")? '%Y年/%m月' : l10n.year_format)
            }
            this.options = _.defaults(_options || {}, this.options)
        },
    });
return DatePicker;
})


